var t = new(require("../../../utils/http").HTTP);
Page({
  data: {
    previousPage: 1,
    total: 1,
    show: !1
  },
  onLoad: function (t) {
    var a = wx.getStorageSync("user");
    1 == t.id ? wx.setNavigationBarTitle({
        title: "跟进记录"
      }) : wx.setNavigationBarTitle({
        title: "联系记录"
      }),
      this.setData({
        id: t.id,
        user: a
      })
  },
  inputVal: function (t) {
    this.setData({
      inputValue: t.detail.value
    })
  },
  searchqymc: function () {
    var a = this;
    this.data.inputValue && (a.setData({
      list: []
    }), a.data.user[4] > 6 ? t.request({
      url: "https://www.qlsyyun.com:3030/client/num",
      data: {
        arr: 7,
        qymc: a.data.inputValue
      }
    }).then((function (e) {
      a.setData({
          pageDown: e.data[0].num,
          show: !0
        }),
        t.request({
          url: "https://www.qlsyyun.com:3030/client/serch",
          data: {
            arr: 7,
            total: a.data.total,
            qymc: a.data.inputValue
          }
        }).then((function (t) {
          a.setData({
            list: t.data
          })
        }))
    })) : 6 == a.data.user[4] ? t.request({
      url: "https://www.qlsyyun.com:3030/client/num",
      data: {
        arr: 8,
        qymc: a.data.inputValue,
        bumen: a.data.user[1]
      }
    }).then((function (e) {
      a.setData({
          pageDown: e.data[0].num,
          show: !0
        }),
        t.request({
          url: "https://www.qlsyyun.com:3030/client/serch",
          data: {
            arr: 8,
            total: a.data.total,
            qymc: a.data.inputValue,
            bumen: a.data.user[1]
          }
        }).then((function (t) {
          a.setData({
            list: t.data
          })
        }))
    })) : t.request({
      url: "https://www.qlsyyun.com:3030/client/num",
      data: {
        arr: 9,
        qymc: a.data.inputValue,
        tname: a.data.user[0]
      }
    }).then((function (e) {
      a.setData({
          pageDown: e.data[0].num,
          show: !0
        }),
        t.request({
          url: "https://www.qlsyyun.com:3030/client/serch",
          data: {
            arr: 9,
            total: a.data.total,
            qymc: a.data.inputValue,
            tname: a.data.user[0]
          }
        }).then((function (t) {
          a.setData({
            list: t.data
          })
        }))
    })))
  },
  seasousuo: function () {
    var a = this;
    this.data.inputValue && (a.setData({
      lists: []
    }), a.data.user[4] > 5 ? t.request({
      url: "https://www.qlsyyun.com:3030/client/num",
      data: {
        arr: 10,
        qymc: a.data.inputValue
      }
    }).then((function (e) {
      a.setData({
          pageDown: e.data[0].num,
          show: !0
        }),
        t.request({
          url: "https://www.qlsyyun.com:3030/client/serch",
          data: {
            arr: 10,
            total: a.data.total,
            qymc: a.data.inputValue
          }
        }).then((function (t) {
          a.setData({
            lists: t.data
          })
        }))
    })) : t.request({
      url: "https://www.qlsyyun.com:3030/client/num",
      data: {
        arr: 11,
        qymc: a.data.inputValue,
        tname: a.data.user[0]
      }
    }).then((function (e) {
      a.setData({
          pageDown: e.data[0].num,
          show: !0
        }),
        t.request({
          url: "https://www.qlsyyun.com:3030/client/serch",
          data: {
            arr: 11,
            total: a.data.total,
            qymc: a.data.inputValue,
            tname: a.data.user[0]
          }
        }).then((function (t) {
          a.setData({
            lists: t.data
          })
        }))
    })))
  },
  previousPage: function () {
    1 == this.data.id ? this.data.previousPage > 1 && (this.setData({
      total: this.data.total - 1,
      previousPage: this.data.total - 1
    }), this.searchqymc(), wx.pageScrollTo({
      scrollTop: 0
    })) : this.data.previousPage > 1 && (this.setData({
      total: this.data.total - 1,
      previousPage: this.data.total - 1
    }), this.seasousuo(), wx.pageScrollTo({
      scrollTop: 0
    }))
  },
  pageDown: function () {
    1 == this.data.id ? this.data.previousPage < this.data.pageDown && (this.setData({
      total: this.data.total + 1,
      previousPage: this.data.total + 1
    }), this.searchqymc(), wx.pageScrollTo({
      scrollTop: 0
    })) : this.data.previousPage < this.data.pageDown && (this.setData({
      total: this.data.total + 1,
      previousPage: this.data.total + 1
    }), this.seasousuo(), wx.pageScrollTo({
      scrollTop: 0
    }))
  },
  qingkong: function () {
    this.setData({
      lists: [],
      list: [],
      firmtext: "",
      show: !1
    })
  }
});